import fetch from 'common/src/utils/fetch';

/**
 * 我的强化班查询
 * @param {*} params 
 */
export function myStrengthClassInfo(studentId) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/myStrengthClassInfo?studentId=' + studentId,
    method: 'get'
  })
}

/*
*签署承诺书
*/
export function signThePromise(template) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/signThePromise',
    method: 'post',
    data: template
  })
}

/**
 * 导出签署承诺书
 * @param {Object} params
 */
export function exportMyCommitmentPdf(params) {
  const url = '/api/cultureservice/ScAdmStuRel/exportMyCommitmentPdf';
  let queryParam = ''
  for (const key in params) {
    // 去掉空参数
    if (
      key === 'pageNum_' ||
      key === 'pageSize_' ||
      key === 'total_' ||
      params[key] === ''
    ) {
      continue
    }
    queryParam += `${key}=${params[key]}&`
  }
  window.open(`${url}?${queryParam}`)
}

/**
 * 个人计划中强化班课程
 * @param {*} params 
 */
export function getMyScCourseScheduled(studentId,scAdmStuRelId) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/getMyScCourseSchedule?studentId=' + studentId + '&scAdmStuRelId=' + scAdmStuRelId,
    method: 'get'
  })
}

/**
 * 缴费回调
 * @param {*} data 
 */
export function strengthenClassPayCallback(data) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/strengthenClassPayCallback',
    method: 'post',
    data: data
  })
}

/**
 * 强化班学生缴费数据校验接口
 * @param {*} params 
 */
 export function strengthenClassPayValidate(studentId, scTypeCode, schoolYear, registId) {
  return fetch({
    url: '/api/cultureservice/ScAdmStuRel/strengthenClassPayValidate?studentId=' + studentId + '&scTypeCode=' + scTypeCode + '&schoolYear=' + schoolYear + '&registId=' + registId,
    method: 'get'
  })
}


